import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:"/home"
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
  {
    path: '/secondHand',
    name: 'secondHand',
    component: () => import(/* 路由懒加载 */ '../views/secondHandView.vue')
  }, 
  {
    path: '/AnewHouse',
    name: 'AnewHouse',
    component: () => import(/* 路由懒加载 */ '../views/AnewHouseView.vue')
  }, 
  {
    path: '/estate',
    name: 'estate',
    component: () => import(/* 路由懒加载 */ '../views/estateView.vue')
  },
  {
    path: '/onSale',
    name: 'onSale',
    component: () => import(/* 路由懒加载 */ '../views/onSaleView.vue')
  },
  {
    path: '/rental',
    name: 'rental',
    component: () => import(/* 路由懒加载 */ '../views/rentalView.vue')
  },
  {
    path: '/Office',
    name: 'Office',
    component: () => import(/* 路由懒加载 */ '../views/OfficeView.vue')
  },
  {
    path: '/village',
    name: 'village',
    component: () => import(/* 路由懒加载 */ '../views/villageView.vue')
  },
  {
    path: '/houseDetail',
    name: 'houseDetail',
    component: () => import(/* 路由懒加载 */ '../views/houseDetailView.vue')
  },
  {
    path: '/userInfo',
    name: 'userInfo',
    component: () => import(/* 路由懒加载 */ '../views/userInfoView.vue')
  },
  {
    path: '/release',
    name: 'release',
    component: () => import(/* 路由懒加载 */ '../views/releaseView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  // scrollBehavior() {
  //   // 始终滚动到顶部
  //   return { top: 0 }
  // },
})

export default router
